using ServiceStack.Model;
using System;
namespace ServiceStack.Messaging
{
	public class Message : IMessage, IHasId<Guid>
	{
		public Guid Id
		{
			get;
			set;
		}
		public DateTime CreatedDate
		{
			get;
			set;
		}
		public long Priority
		{
			get;
			set;
		}
		public int RetryAttempts
		{
			get;
			set;
		}
		public Guid? ReplyId
		{
			get;
			set;
		}
		public string ReplyTo
		{
			get;
			set;
		}
		public int Options
		{
			get;
			set;
		}
		public ResponseStatus Error
		{
			get;
			set;
		}
		public string Tag
		{
			get;
			set;
		}
		public object Body
		{
			get;
			set;
		}
	}
	public class Message<T> : Message, IMessage<T>, IMessage, IHasId<Guid>
	{
		public Message()
		{
			base.Id = Guid.NewGuid();
			base.CreatedDate = DateTime.get_UtcNow();
			base.Options = 1;
		}
		public Message(T body) : this()
		{
			base.Body = body;
		}
		public static IMessage Create(object oBody)
		{
			return new Message<T>((T)((object)oBody));
		}
		public T GetBody()
		{
			return (T)((object)base.Body);
		}
		public override string ToString()
		{
			return string.Format("CreatedDate={0}, Id={1}, Type={2}, Retry={3}", new object[]
			{
				base.CreatedDate,
				base.Id.ToString("N"),
				typeof(T).get_Name(),
				base.RetryAttempts
			});
		}
	}
}
